﻿using System;
using NGen = NGenerics.DataStructures.General;

namespace Layers.History
{

    public interface ISerial
    {
        long SerialID { get;  }
    }

    public interface ITimeSerial
    {
        DateTime TimeStamp {get;}
    }

    public class TimeSerial<E>: ITimeSerial, ISerial
    {
        private long _ticks;
        private E _value;

        public E Value {get{return _value;} set{_value=value;}}
        
        public DateTime TimeStamp
        {
            get{return new DateTime(_ticks);}
            set{_ticks = value.Ticks;}
        }

        public long SerialID { get { return _ticks; } }

        public TimeSerial(DateTime time, E value)
        {
            _ticks = time.Ticks;
            Value = value;
        }

        public TimeSerial()
        {
            _ticks = 0;
            _value = default(E);
        }
    }
}